<?php
$awal = datefmysql($params['awal']);
$akhir = datefmysql($params['akhir']);
$donatur_tunggal = $params['donaturTunggal'];
$id_donatur_tunggal = $params['idDonaturTunggal'];
$namaFile = 'keuangan_donatur_tunggal.xls';

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");

// header untuk nama file
header("Content-Disposition: attachment;
                filename=".$namaFile."");

header("Content-Transfer-Encoding: binary ");
?>
<html>
    <head>
        <title>Cetak Laporan Keuangan Donatur Tunggal</title>
        <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>system/css/style2.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>system/css/tabel.css" />
    </head>
    <body>
    <table border="0">
        <tr bgcolor="#cccccc">
            <td colspan="8" align="center"><strong><font size="+1">Laporan Keuangan Donatur Tunggal</font></strong></td>
        </tr>
        <tr bgcolor="#cccccc">
            <td colspan="8" align="center"><strong><font size="+1">Periode <?php echo indo_tgl($awal)?> s.d <?php echo indo_tgl($akhir)?></font></strong></td>
        </tr>
        <?php
          if($donatur_tunggal != ''){
        ?>
        <tr bgcolor="#cccccc">
            <td colspan="8" align="center"><strong><font size="+1">Nama Donatur Tunggal : <?php echo "$donatur_tunggal";?></font></strong></td>
        </tr>
        <?php
          }
        ?>
    </table>
    <div class="data-list">
        <table class="tabel">
            <tr>
                <th>No</th>
                <th>Tanggal</th>
                <th>Petugas</th>
                <th>Donatur Tunggal</th>
                <th>Keterangan</th>
                <th>Debet (Rp.)</th>
                <th>Kredit (Rp.)</th>
                <th>Saldo (Rp.)</th>
            </tr>
            <?php
            $offsets = isset ($offset)?$offset:0;
            $no = 1 + $offsets;
            foreach ($data as $row){
            ?>
            <tr class="<?php echo ($no%2)?"even":"odd";?>">
                <td style="text-align: center"><?php echo $no++;?></td>
                <td><?php echo datefmysql($row['tanggal'])?></td>
                <td><?php echo $row['petugas']?></td>
                <td><?php echo $row['donatur_tunggal']?></td>
                <td><?php echo $row['keterangan']?></td>
                <td style="text-align: right">
                   <?php 
                      echo ($row['debet']!=0)?rupiah($row['debet']):"-";
                   ?>
                </td>
                <td style="text-align: right">
                   <?php 
                      echo ($row['kredit']!=0)?rupiah($row['kredit']):"-";
                   ?>
                </td>
                <td style="text-align: right"><?php echo rupiah($row['saldo'])?></td>
            </tr>
            <?php
            }
            ?>
        </table>
    </div>
    </body>
</html>   